$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL +'exchangeCNY/ling/exchangeCnySeq',
        datatype: "json",
        colModel: [
            { label: '提现流水id', name: 'id', index: "id", width: 45, key: true,hidden:true },
            { label: '真实姓名', name: 'realName',width: 70},
            { label: '手机号', name: 'mobileNumber',width: 60},
            { label: '类型', name: 'exchangecnyTypeName', width: 45},
            { label: '金额', name: 'amount',width: 45},
            { label: '收款账户', name: 'receiveAccount',width: 70},
            { label: '时间', name: 'createTime',width: 70},
            { label: '状态', name: 'exchangeStatusName', width: 40}
        ],
        viewrecords: true,
        height: 385,
        rowNum: 10,
        rowList : [10,30,50],
        rownumbers: true,
        rownumWidth: 25,
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.result",
            page: "page.pageNo",
            total: "page.totalPages",
            records: "page.total"
        },
        prmNames : {
            page:"page",
            rows:"limit",
            order: "order"
        },
        gridComplete:function(){
            //隐藏grid底部滚动条
            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
        }
    });
});

var vm = new Vue({
    el:'#exchangeCNY',
    data:{
        q:{
            realName: null,
            mobileNumber:null,
            startDate:null,
            endDate:null
        },
        reason:false,
        showList: true,
        info:{
            id:null,
            reason:null
        }

    },
    methods: {
        query: function () {
            vm.reload();
        },
        reload: function () {
            vm.showList = true;
            var page = $("#jqGrid").jqGrid('getGridParam','page');
            $("#jqGrid").jqGrid('setGridParam',{
                postData:{'realName': vm.q.realName,'mobileNumber': vm.q.mobileNumber,'startDate':vm.q.startDate,'endDate':vm.q.endDate},
                page:page
            }).trigger("reloadGrid");
        }
    }
});
layui.use('laydate', function(){
    var laydate = layui.laydate;
    laydate.render({
        elem: '#startDate',
        format:'yyyy-MM-dd HH:mm:ss',
        done: function(value, date, endDate){
            vm.q.startDate = value;
        }
    });
    laydate.render({
        elem: '#endDate',
        format:'yyyy-MM-dd HH:mm:ss',
        done: function(value, date, endDate){
            vm.q.endDate = value;
        }
    });
});
